﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ORMapping
{
    public static class Helper
    {
        public static byte[] ReadMemberPhoto(Int32? MemberId)
        {
            try
            {
                using (var f = System.IO.File.Open(SavePhotoPath(MemberId), System.IO.FileMode.Open))
                {
                    var photo = new byte[f.Length];
                    f.Read(photo, 0, (int)f.Length);
                    return photo;
                }
            }
            catch (Exception e)
            {
                return null;
            }            
        }

        public static String SavePhotoPath(Int32? MemberId)
        {
            return String.Concat(Enums.Environment.CurrentDirectory,"\\Photo\\", MemberId.ToString(), ".bmp");
        }
    }
}
